﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FATCASchema.Nodes
{
    public class FATCANode : iNode
    {
        public string Name { get; private set; }
        public bool AllowAddChildren { get; private set; }
        public List<iNode> Children { get; private set; }
        public object NodeObject { get; private set; }

        public FATCANode(Fatca_Type nodeObject)
        {
            this.Name = "FATCA";
            this.NodeObject = nodeObject;
            this.AllowAddChildren = true;
            this.LoadChildren();
        }

        public void LoadChildren()
        {
            if (this.NodeObject == null)
                return;

            var nodeObject = (Fatca_Type)this.NodeObject;
            this.Children = new List<iNode>();
            this.Children.Add(new CorrectableOrganisationParty("ReportingFI", nodeObject.ReportingFI));

            foreach (var item in nodeObject.ReportingGroup)
            {
                this.Children.Add(new ReportingGroupNode(item));
            }
        }

        public void AddChild()
        { }

        public void LoadPane()
        { }
    }
}
